#include <stdio.h>
#include <unistd.h>
#include <signal.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/wait.h>

void handler(int signo)
{
  printf("catch a signal : %d\n",signo);
}

int main(int argc, int *argv[])
{
  //if(fork() == 0){
  //  printf("child pid:%d\n", getpid());
  //  int *p = NULL;
  //  *p = 20;
  //  sleep(2);
  //  exit(0);
  //}

  //int status = 0;
  //waitpid(-1, &status, 0);
  //printf("exit code: %d coredump: %d signal: %d\n",\
  //      (status>>8)&0xff, (status>>7)&1, status&0x7f);

  //signal(SIGSEGV, handler);
  sleep(1);
  int *p = NULL;
  *p = 10;

  while(1){
    //printf("hello test\n");
    //sleep(1);
    //raise(2);
  }
  //kill(atoi(argv[[1]]),atoi(argv[2]))
   //signal(2,handler);
   //while(1)
   //{
   // printf("hello ... \n");
   // sleep(1);
   //}
    return 0;
}
